package com.activemq;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class LogController {
	@Autowired  
	private LogProducer logProducer;  
	  
	@GetMapping("/activemq/send")  
	public String sendQueue(HttpServletRequest request, String msg) {  
	    msg = StringUtils.isEmpty(msg) ? "This is Empty Msg." : msg;  
	  
	    try {
	        logProducer.send(msg);
	    } catch (Exception e) {  
	        e.printStackTrace();  
	    }
	    return "Activemq has sent OK.";  
	}
	
	/*@GetMapping("/activemq/sendTopic")  
	public String sendTopic(HttpServletRequest request, String msg) {  
	    msg = StringUtils.isEmpty(msg) ? "This is Empty Msg." : msg;  
	  
	    try {
	        logProducer.sendTopic(msg);
	    } catch (Exception e) {
	        e.printStackTrace();  
	    }
	    return "Activemq has sent OK.";  
	}*/
}
